<template>
  <div class="form">
    
    <el-form
      :model="ruleForm"
      :rules="rules"
      ref="ruleForm"
      label-width="100px"
      class="demo-ruleForm"
    >
      <el-form-item label="姓名" prop="StuName">
        <el-input v-model="ruleForm.StuName"></el-input>
      </el-form-item>
      <el-form-item label="学号" prop="StuId">
        <el-input v-model="ruleForm.StuId"></el-input>
      </el-form-item>
      <el-form-item label="手机号" prop="StuPhone">
        <el-input v-model="ruleForm.StuPhone"></el-input>
      </el-form-item>
      <el-form-item label="性别" prop="StuSex">
        <el-select v-model="ruleForm.StuSex" placeholder="请选择性别">
          <el-option label="男" value="male"></el-option>
          <el-option label="女" value="female"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="年龄" prop="StuAge">
        <el-input v-model="ruleForm.StuAge"></el-input>
      </el-form-item>
      <el-form-item label="入学时间" prop="StubackTime">
        <el-input v-model="ruleForm.StubackTime"></el-input>
      </el-form-item>
      <el-form-item label="邮箱" prop="StuEmail">
        <el-input v-model="ruleForm.StuEmail"></el-input>
      </el-form-item>
      <el-form-item label="班级" prop="ClassId">
        <el-input v-model="ruleForm.ClassId"></el-input>
      </el-form-item>
      <el-form-item label="年级" prop="Grade">
        <el-input v-model="ruleForm.Grade"></el-input>
      </el-form-item>
      <!-- <el-form-item label="学院" prop="college ">
        <el-input v-model="ruleForm.college "></el-input>
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" @click="submitForm('ruleForm')">提交申请</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  props: ["status"],
  data() {
    return {
      ruleForm: {
        name: "",
        StuId: "",
        StuPhone: "",
        StuSex: "",
        StuAge: "",
        StubackTime: "",
        StuEmail: "",
        ClassId: "",
        Grade: "",
        college: ""
      },
      rules: {
        name: [{ required: true, message: "请输入姓名", trigger: "blur" }],
        StuId: [{ required: true, message: "请输入学号", trigger: "blur" }],
        StuPhone: [
          { required: true, message: "请输入手机号", trigger: "blur" }
        ],
        StuSex: [{ required: true, message: "请输入性别", trigger: "blur" }],
        StuAge: [
          { required: true, message: "请输入年龄", trigger: "blur" },
          { type: "number", message: "年龄必须为数字值" }
        ],
        StubackTime: [
          { required: true, message: "请输入入学时间", trigger: "blur" }
        ],
        StuEmail: [
          { required: true, message: "请输入电子邮件", trigger: "blur" }
        ],
        ClassId: [{ required: true, message: "请输入班级", trigger: "blur" }],
        Grade: [{ required: true, message: "请输入年纪", trigger: "blur" }],
        //college: [{ required: true, message: "请输入学院", trigger: "blur" }]
      }
    };
  },
  created () {
    this.userInfo()
  },
  methods: {
    userInfo(){
      this.ruleForm = JSON.parse(sessionStorage.getItem("user"))

    },
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          alert("submit!");
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
    }
  }
};
</script>

<style scoped>
.form {
  overflow-y: scroll;
  min-height: 400px;
  height: 500px;
}
.el-divider--vertical{
  height: 25em;
}
</style>
